home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 1996 May / Software of the Month Club 1996 May.iso / mac / ISO9660 / ZIPFILES / LXLT101.ZIP / lxlite.doc < prev    next >
Encoding:
Text File  |  1996-02-23  |  20.9 KB  |  412 lines

  1.               ──────────────────────────────────────────────
  2.                LX lite - an compressor for OS/2 executables
  3.               ──────────────────────────────────────────────
  4.  
  5.                                  Dedication: To my little daughter Alice,
  6.                                              born 12 Feb, 1996 at 03:45.
  7.  
  8.   1. Distribution
  9.   ───────────────
  10.    This program is freeware. This mean that you can distribute it in any way,
  11.  except  for  commercial use. Commercial use is allowed ONLY with my personal
  12.  permission.  To  contact me see the the last section in this file. This also
  13.  means  that  you  have  NO  guaranties that it will perform exactly what YOU
  14.  need. I cannot carry any responsability for any damages, lost of profit etc.
  15.  caused  by  use  or  inability to use this program.
  16.    However,  you CAN use it to enhance any, even commercial, product. This is
  17.  not  for  YOUR benefit but rather for benefit of poor users who are BORED of
  18.  the big size of executables.
  19.    The  program is written exclusively in Virtual Pascal, beta 3, with use of
  20.  its  built-in  32-bit  assembler.  This is an excellent language which takes
  21.  full  advantages  of  OS/2`s possibilities, is BorlandPascal compatible, and
  22.  have  a  powerful  built-in optimizer. If you want the lxLite`s source code,
  23.  please  mail  me,  but  you have to tell me WHY do you need it, to avoid the
  24.  people which likes to re-sell other`s programs under their name.
  25.  
  26.   2. Introduction
  27.   ───────────────
  28.    I  think  all  of  us  are  really  bored  of  the  big  size  and reduced
  29.  functionality  of  all  those  modern  executables written to run under OS/2
  30.  (windos  too).  I  don`t  understand  why  they  are  so  big,  because most
  31.  compilers,  even  IBM  CSet  generate a modest size code. For a widely known
  32.  example  let`s  take  MultiMaint.  What  a complex task it performs that its
  33.  executable  occupies  more  that  700K?  I  don`t  understand. Moreover, WHY
  34.  duplicate  (and  triplicate)  almost  the same executable as it does (I mean
  35.  MultiSafe  and  IniMaint  which  comes along with MultiMaint). It performs a
  36.  nice  work,  but it is TOO big for the task it acomplishes. OS/2 kernel have
  37.  the  same  size.  I  cannot  afford such a large pile of shit on my HD, so I
  38.  killed MultiMaint & C°. :`-(. Too bad for its author.
  39.    Here is a workaround for this. You can just pack the executable so it will
  40.  be  twice  smaller  and  still perform the same task. Alas, it will grab the
  41.  same amount of memory as original executable does - this is the fault of the
  42.  program`s author.
  43.    As  far  as  I know there is only one program which does the same - REPACK
  44.  from  IBM  (EWS?).  But  compared  to lxLite it gives larger files using the
  45.  same algorithm. For example, COURIER.FON from OS/2 v8.192 it compresses into
  46.  44K  and  lxLite  into  34K.  Feel  the  difference.  BTW,  LINK386+Resource
  47.  Compiler  compiles  COURIER.FON  also into 44K-size file. This make me think
  48.  that they use the same common library.
  49.    I  packed  ALL  my executables (incuding but not limiting to ?:\os2\*.exe,
  50.  ?:\os2\dll\*.*  and  ?:\os2\dll\ibmnull;laserjet)  and  my  system  is stiil
  51.  working  fine  :-)  One  of lxLite users (Pavel Roskin) observed that lxLite
  52.  packs  even  os2krnl :-) This is a very nice feature to create a SINGLE OS/2
  53.  boot diskette.
  54.  
  55.   3. Features
  56.   ───────────
  57.    lxLite  compresses  the files in the same way as LINK386 does. There is NO
  58.  way  of  implementing a executable packing method other than those two which
  59.  Warp  uses  (or  the only for 2.x). So, here is a brief description of those
  60.  two algorithmhs:
  61.  
  62.    1.  Run-length packing. This is generally the same method that Microsoft C
  63.  for  DOS uses. It gives VERY bad results because the structure of executable
  64.  files  aren`t  suited  for that kind of packing. For example, PCX files uses
  65.  approximatively the same packing method.
  66.  
  67.    2.  Kinda Lempel-Ziv algorithm. Lempel-Ziv is the same method which almost
  68.  all  DOS  executables  packers  use  - LZEXE, PKLITE, PGMPAK etc. The method
  69.  standartized  for  OS/2  executable  files is not the most effective (IMHO).
  70.  Other  thing  is  that OS/2 executable have a different loading algorithm in
  71.  contrast to DOS executables - parts of OS/2 executables are loaded only when
  72.  they  are  needed.  So,  Lempel-Ziv  dictionary  cannot cross the bound of a
  73.  single page (4096 bytes). Because of this, it gives not such good results as
  74.  it can.
  75.  
  76.    lxLite  can  use any of these two methods either for packing or unpacking.
  77.  Generally  the second gives best compression rates, but may be (?) there are
  78.  some  files  on which first will work better. Because of this the default is
  79.  to  try  to pack page using both methods and then choose the smaller result.
  80.  lxLite can be used as well for unpacking the files that previously have been
  81.  packed - either by lxLite, LINK386 or REPACK from IBM.
  82.  
  83.    What  kind  of  files  you  can  compress?  The  LX  format is used almost
  84.  everywhere in OS/2: almost everything is in LX format. So, you don`t have to
  85.  limit  only  to  .EXE files: you can pack .DLL, .PDR, .QPR, .DRV, .FON, .SYS
  86.  (Virtual  Device Drivers (VDDs) in \OS2\MDOS) as well. You can run lxLite on
  87.  virtually  any  file:  if it is not in Linear Executable (LX) format it will
  88.  refuse to process it.
  89.  
  90.    You can also consider compressing your entire \OS2\*\ directory structure,
  91.  it  will  give you a lot of extra space and absolutely no overhead! The time
  92.  spent  for  decompressing  executables is recovered by the time which system
  93.  does  not  spend  for  reading  the  executable  from  HD  because it`s much
  94.  smaller!  So, reboot from stand-alone OS/2 diskettes (you can boot from OS/2
  95.  installation  diskettes  (first  two)  then  press F3), then change to drive
  96.  where your OS/2 is and type
  97.   \[path]\lxLite os2\*.exe os2\dll\*.* os2\dll\ibmnull\*.drv
  98.    and  so  on.  Also  you  can compress now the executables which are run at
  99.  system   startup,  because  when  they  are  run  you  cannot  modify  their
  100.  executables and DLL`s.
  101.  
  102.    lxLite  version 1.00 and above can replace executable modules even if they
  103.  are  currently  in use. In this case it will warn you that module is already
  104.  in  use by another process, and will propose you either to replace it by its
  105.  packed  version  or  either  to  skip  this module. Choose at your wish, but
  106.  keep  in  mind  that  the  modules you have replaced are kept now (their old
  107.  versions)  in  memory,  so they eat up your swapfile space. Better reboot as
  108.  soon as you have this opportunity.
  109.  
  110.    Versions  above  1.00 are supplied in two different executables: one named
  111.  lxLite.exe  is  the  usual  version  for OS/2 v2.99, Warp and aboves. Other,
  112.  named  lxLite2x.exe  is meant for use in old versions of OS/2 (i.e. 2.x, NOT
  113.  1.x because 1.x doesn`t have the LX format). Delete it if you`re a OS/2 Warp
  114.  user.
  115.  
  116.   4. Options
  117.   ──────────
  118.    There are alot of options in lxLite. I simply like options :-) So, you can
  119.  configure almost anything in lxLite. Moreover, to protect the user from need
  120.  of writing the same options lxLite support multiple configurations which are
  121.  kept  in  a  single  file.  lxLite  comes  with  some example configurations
  122.  (`factory defaults`) which are listed below:
  123.  ────────────────────────────────────────────────────────────────────────────
  124.   default: (loaded by default)
  125.    It is a `work` configuration. All parameters are set to maximize
  126.    compression. .BAK file creation is disabled. Note that this configuration
  127.    is ALWAYS loaded before any other options are in effect, so even /C{#}
  128.    option is executed AFTER default configuration is loaded.
  129.  
  130.   fast: Lowest compression level, fastest executable loading. According
  131.    to IBM when data objects are aligned inside of file on sector boundary
  132.    (512 bytes) executable will load faster. I cannot observe a difference,
  133.    so try it at your own. If some data in executable was previously packed
  134.    it is not de-packed then re-packed.
  135.  
  136.   fast2: Compress a bit better, but slower. Loads as fast as CFG#1 does.
  137.  
  138.   ver2x: Optimal for pre-Warp versions of OS/2. Versions before Warp (3.0)
  139.    does not know of the Lempel-Ziv (/EXEPACK:2) method. DON`T PACK
  140.    EXECUTABLES WITH LEMPEL-ZIV`s ALGORITHM if there is a chance to run
  141.    your program on OS/2 v2.xx (except 2.99).
  142.  
  143.   failsafe: Lempel-Ziv packing enabled. A `fail-safe` configuration.
  144.    All data are written just like LINK386 does, because of this creates a
  145.    bit bigger files than using default configuration. FOR WARP ONLY!
  146.  
  147.   max: Tightest compression level. VERY SLOW! It is rarely needed to use
  148.    this configuration.
  149.  
  150.   newStub: This is a particular configuration used to replace one DOS stub
  151.    in LX executable by another without altering anything else. You have to
  152.    specify a filename for new stub - this configuration only tells lxLite
  153.    not to depack old objects and not to pack unpacked objects.
  154.  
  155.   minStub: This is a configuration which is linked to newStub and replaces
  156.    stubs in given files by minimal possible stub of `say-error-and-exit`
  157.    type. You cannot make it smaller (at least I doubt it), only if you
  158.    shorten the error message.
  159.  
  160.   vdmStub: This configuration tells lxLite to replace in specified files
  161.    stub by a `run-from-VDM`-style one. This is also as short as possible :-)
  162.    Please read the /T{#} option description for further details.
  163.  
  164.   info: Use this configuration to get information about executables (see
  165.    options /V+) without rewriting them.
  166.  ────────────────────────────────────────────────────────────────────────────
  167.    To  use  a specific configuration use /C# where # is configuration`s name.
  168.  The  settings  are  stored  into file lxLite.CFG in the same directory where
  169.  lxLite.EXE resides. You shouldn`t care about paths - lxLite will always find
  170.  it. For example, to use `max` configuration run lxLite /cMax. For a detailed
  171.  description of .CFG file format see section right below the following.
  172.  
  173.    Here  is  a  detailed  explanation of what each switch does. Note that any
  174.  switch  which  accepts  '+'  or  '-'  sign  after  it (to enable/disable the
  175.  action which switch symbolizes) can be used without anything after it - this
  176.  is accepted as '+'. So, /V+ is equivalent to /V.
  177.  
  178.   ■ /A{P|S|N{P|S}}
  179.      Set alignment method for first and rest of objects. First object can
  180.      be aligned on [P]age shift, [S]ector or [N]o boundary. Note that the
  181.      last option (No boundary) is never used by LINK386, but it works well,
  182.      and the LX format allows it. All objects except first MUST be aligned
  183.      at least on a PageShift boundary. PageShift is a value that is specified
  184.      in LX header. If you want to redefine it use /R# option.
  185.  
  186.   ■ /B{+|-}
  187.      Enable (+) or disable (-) renaming of original file into .BAK.
  188.      Note that this is a BETA version - that is why .bak files are
  189.      enabled by default.
  190.  
  191.   ■ /C{#}
  192.      Use configuration with ID = #
  193.      The two predefined configuration names are "default" and "unpack".
  194.      First is always loaded as lxLite starts and second is used when /X+
  195.      option is specified (NOT equivalent to /cUnpack).
  196.  
  197.   ■ /D{+|-}
  198.      Keep (+) or remove (-) [D]ebug info if encountered in executables.
  199.      Some vendors forget (?) to relink their applications without
  200.      debug info when it is complete. It will save you some space and will
  201.      not affect at all the functionality of program itself. By default
  202.      it is enabled (i.e. removes debug info).
  203.  
  204.   ■ /F{+|-}
  205.      Forced repacking. Use /F+ to bypass `already processed` message, i.e.
  206.      when lxLite thinks that file was already processed and it really wasn`t.
  207.      This usually doesn`t happen, but can happen when you try to replace a
  208.      stub by another of the same size in a already packed file.
  209.  
  210.   ■ /M{R{N|1|2|3}|L{N|1}}
  211.      Set packing method & parameters. Second character defines the method
  212.      to set-up: `R` stands for run-length (/EXEPACK:1) and 'L' for Lempel-Ziv
  213.      (/EXEPACK:2). The third character is the level of compression using that
  214.      method; if N is specified the method is disabled. Three levels of
  215.      packing are provided for run-length compression. The level 1 is the
  216.      fastest. It searches only for 1-character strings. For example, the
  217.      'AAAAAAAA' string will be detected and packed as 8, 1, 'A' while
  218.      'ABABABAB' string will be stored as unpacked text. Level 2 detects
  219.      strings of any length up to 16 characters long. The example above will
  220.      be encoded then as 4,2,'AB'. This is the default setting for most
  221.      'factory` configurations. And last, 3rd level searchs for ALL strings
  222.      of any length (up to page size/2 = 2048). This compress VERY slow and
  223.      seldom gives real results, so use it only when you really need it.
  224.      The Lempel-Ziv algorithm can be either disabled (/MLN) or enabled (/ML1).
  225.      When enabled it searchs for all matches using a relatively fast
  226.      hash-table, so there is no need in gradations by compression speed.
  227.  
  228.   ■ /P{+|-}
  229.      Enable (+) or disable (-) pause before each file.
  230.      The program shows the name of file which will be processed and
  231.      offers a choice to continue or to abort.
  232.  
  233.   ■ /R{#}
  234.      [R]e-align pages on specific boundary. (#) must be a power of two.
  235.      This is an analog of LINK386`s /ALIGN: switch. Many of the programmers
  236.      don`t care that the default setting for /A: is to align each page
  237.      inside the executable on 512 (sector) bound. The result is a lot of
  238.      unused space inside the executable. You can `re-link` such files with
  239.      another /ALIGN: option. Default is /R:4. To force lxLite to behave
  240.      like LINK386 you must use /R:512 option. This is equivalent to /ASS :-)
  241.      option.
  242.  
  243.   ■ /S{+|-}
  244.      Show (+) or don`t show (-) configuration in effect.
  245.      This is useful for examining which settings are stored into .CFG file,
  246.      especially for linked configurations (see below). For example
  247.      lxLite /Cdefault /S will show the default settings.
  248.  
  249.   ■ /T{#}
  250.      Use specified file as new DOS stub. DOS stub is a little DOS .EXE file
  251.      linked to OS/2`s LX file which is usually used to type an error message
  252.      in the case if the executable is not run from DOS command line. Usually
  253.      this looks like:
  254.  
  255.      This is an OS/2 executable module
  256.  
  257.      Along with lxLite are enclosed two stubs: stub_min.bin and stub_vdm.bin.
  258.      First is the standard `type-error-and-exit` type, but it is slightly
  259.      smaller than usual stubs used by various linkers. The second is an stub
  260.      which starts a new OS/2 session and runs program from it again. If OS/2
  261.      is not detected it types the same error message and exits.
  262.  
  263.   ■ /U{+|-}
  264.      Enable (+) or disable (-) unpacking file before packing
  265.      lxLite know how to unpack any of two methods described, so default
  266.      option state is enabled. Disable it only if you wish to save time.
  267.  
  268.   ■ /V{+|-}
  269.      Verbose (show alot of file information)
  270.      This is a switch for curious ones :-) It displays a little information
  271.      about processed file (to get full information on .LX file use exeHdr.EXE
  272.      from OS/2 Programmer`s Toolkit).
  273.  
  274.   ■ /W{+|-}
  275.      Enable (+) or disable (-) the [W]riting of resulting file to disk.
  276.      By default it is enabled, but you can disable it if you wish to examine
  277.      the executable information (/V+) without having rewritten or repacked file.
  278.      Also this option can be useful for debugging your options.
  279.  
  280.   ■ /X{+|-}
  281.      e[X]pand (+) or pack (-) given files.
  282.      Use this switch to decompress files. lxLite can decompress files
  283.      which has been compressed by itself as well as by other programs which
  284.      uses standard methods (i.e. Resource Compiler, LINK386, REPACK). It
  285.      is NOT identical to /cUnpack option.
  286.  
  287.   ■ /Z{#}
  288.      This option will set the `threshold` for lxLite to help him determine
  289.      when stub is a `dummy` one and when it is a functional program. There
  290.      are a number of programs (for example, \os2\xdfloppy.exe) which runs
  291.      both under DOS and OS/2 - in such programs DOS executable is implemented
  292.      into OS/2`s LX as a DOS stub. By default (and using simply /Z) lxLite
  293.      considers all stubs bigger than 1024 bytes as functional ones, and
  294.      therefore on them the /T{#} option has no effect.
  295.  
  296.   /?,/H
  297.      Show a brief help. This is useful when you forget a particular
  298.      switch from all that list :-)
  299.  ────────────────────────────────────────────────────────────────────────────
  300.    The  .CFG  file  format is as simple as possible: it is a plain ASCII text
  301.  file  which  you can edit using any editor which supports them (almost any).
  302.  Any characters after a semicolumn ';' are ignored, i.e. you can put comments
  303.  in configuration file like this:
  304.  
  305.   ; This is an comment
  306.  
  307.    Any  line  begining  with a word and column (ex: "word:") are treated as a
  308.  particular  configuration.  This word is used to identify the configuration.
  309.  This is an example of a configuration entry:
  310.  
  311.   failsafe: /APP /B- /G+ /R4 /MR2 /ML1 /P- /U+ /V-
  312.  
  313.    As  you  can see, after column you should write any switches just like you
  314.  do  with  lxLite  itself.  Recursive  /C options are NOT ignored, so you can
  315.  link  one configuration to another, but /C option is proceeded last, so from
  316.  two overlapping options will be in effect the last one. Just for example:
  317.  
  318.   here: /app /b- /g+
  319.   there: /ass /b+ /p+
  320.  
  321.    Running "lxLite /cThere" will be equivalent to "lxLite /app /b- /p+ /g+"
  322.  Note that lxLite will ignore any sequenced links to the same configuration
  323.  to avoid infinite-loop recursion. So, "lxLite /cOne /cOne" will load `One`
  324.  configuration only ONCE.
  325.  
  326.   5. Error messages
  327.   ─────────────────
  328.    Like  most  normal  programs  :-)  lxLite  can  eventually  generate error
  329.  messages.  Some  of  them  can  appear  in similar conditions, but caused by
  330.  different causes. Here is a short list of the most frequent errors:
  331.  
  332.  * Invalid configuration file format
  333.    Self-explaining, I think :-)
  334.  
  335.  * Error reading configuration file
  336.    This error is generated ONLY if the file is not physically readable.
  337.    The program does not generate an error if the configuration file is
  338.    missing.
  339.  
  340.  * Error writing configuration file
  341.    Self explaining.
  342.  
  343.  * error reading executable
  344.    This is generated if executable is physically unreadable.
  345.  
  346.  * error writing executable
  347.    This is generated if executable cannot be written onto disk. The cause
  348.    can be the insufficience of disk space - lxLite does not check for this
  349.    particular error.
  350.  
  351.  * invalid executable file format
  352.    The file is not in [L]inear [E]xecutable. Note that you can get this
  353.    message for files with .EXE extension in the cause they are in old,
  354.    'New Exe (bwhahaha)' format or DOS executable or winDOS executable.
  355.  
  356.  * unsupported executable format revision
  357.    This error can happen (may be :-) if you try to process an executable
  358.    with other revision number than 0. OS/2 Warp works only with revision
  359.    0, so you will not normally encounter this problem.
  360.  
  361.  * invalid word/dword ordering in executable
  362.    The executable uses little-endian byte order. Seems that it is not for
  363.    Intel platform machines.
  364.  
  365.  * executable target is an unsupported CPU type
  366.    This happen if the target CPU is other than 286, 386, 486 or P5.
  367.  
  368.  * executable target is an unsupported OS
  369.    This mean that the executable is not for OS/2. The windos 95 uses similar
  370.    format, but its magic number is not `LX` but rather `LE`, so usualy
  371.    program will abort with `invalid format` error code.
  372.  
  373.  * unknown entry bundle type in executable
  374.  * unknown page flags in executable
  375.  * invalid object page detected in executable
  376.    It`s something about internal structure that lxLite doesnt know about.
  377.    Please mail me if you encounter such files.
  378.  
  379.  * not enough memory to load executable
  380.    I doubt this error can happen in OS/2 :-) Rather a swap-file full fault
  381.    will occur. BTW, it`s a bad idea of IBM programmers to trap instead of
  382.    returning NIL pointer at memory request :-(
  383.  
  384.   6. Todo list
  385.   ────────────
  386.    Here  is  a  list  of  features I plan to add in some future versions. Any
  387.  suggestions are welcome, to contact me see the last section.
  388.  
  389.  * None - tell me if you wanna something.
  390.  
  391.   7. Known bugs and limitations
  392.   ─────────────────────────────
  393.    Here are a list of executables which failed for some reasons to work
  394.  packed; avoid them.
  395.  * PMJPEG v1.5.  However, even IBM`s REPACK cannot repack it, so I think this
  396.  is  because  of  either  a  bug  in  a  linker  used to generate it (and its
  397.  executable   has  a  strange  structure)  or  a  kind  of  debug  protection
  398.  (executable checksum checking?)
  399.  *  Executables  generated  by  VX-REXX  reportedly lxLite also does not pack
  400.  correctly.  I  will  hopefully  fix  this  as soon as I will get a such test
  401.  executable.
  402.  
  403.   8. Contacting me
  404.   ────────────────
  405.    You can contact me via e-mail at:
  406.  
  407.       FIDOnet: 2:5030/84.5 (prefered)
  408.       e-mail:  Andrew Zabolotny@p5.n84.r5030.z2.fidonet
  409.  
  410.  Enjoy,
  411.    _\ndy.
  412.